package com.ciaojian.worker.controller;

import cn.hutool.core.bean.BeanUtil;
import com.ciaojian.core.model.StoreSmall;
import com.ciaojian.core.model.Store;
import com.ciaojian.core.util.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author oxiny
 */
@Api(tags = "门店模块: 门店")
@Validated
@RestController
@RequestMapping("/store")
public class StoreController {

    @ApiOperation("查询门店")
    @GetMapping("/{id}")
    public Result get(@PathVariable Integer id) {
        Store store = new Store().selectById(id);
        StoreSmall smallStore = new StoreSmall();
        BeanUtil.copyProperties(store, smallStore);
        return Result.ok(smallStore);
    }
}
